<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>simplejson</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;simplejson
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="simplejson-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== PACKAGE DESCRIPTION ==================== -->
<h1 class="epydoc">Package simplejson</h1><p class="nomargin-top"><span class="codelink"><a href="simplejson-pysrc.html">source&nbsp;code</a></span></p>
<p>A simple, fast, extensible JSON encoder and decoder</p>
  <p>JSON (JavaScript Object Notation) &lt;http://json.org&gt; is a subset 
  of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data 
  interchange format.</p>
  <p>simplejson exposes an API familiar to uses of the standard library 
  marshal and pickle modules.</p>
  <p>Encoding basic Python object hierarchies:</p>
<pre class="literalblock">
   &gt;&gt;&gt; import simplejson
   &gt;&gt;&gt; simplejson.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
   '[&quot;foo&quot;, {&quot;bar&quot;: [&quot;baz&quot;, null, 1.0, 2]}]'
   &gt;&gt;&gt; print simplejson.dumps(&quot;\&quot;foo\bar&quot;)
   &quot;\&quot;foo\bar&quot;
   &gt;&gt;&gt; print simplejson.dumps(u'\u1234')
   &quot;\u1234&quot;
   &gt;&gt;&gt; print simplejson.dumps('\\')
   &quot;\\&quot;
   &gt;&gt;&gt; print simplejson.dumps({&quot;c&quot;: 0, &quot;b&quot;: 0, &quot;a&quot;: 0}, sort_keys=True)
   {&quot;a&quot;: 0, &quot;b&quot;: 0, &quot;c&quot;: 0}
   &gt;&gt;&gt; from StringIO import StringIO
   &gt;&gt;&gt; io = StringIO()
   &gt;&gt;&gt; simplejson.dump(['streaming API'], io)
   &gt;&gt;&gt; io.getvalue()
   '[&quot;streaming API&quot;]'
</pre>
  <p>Compact encoding:</p>
<pre class="literalblock">
   &gt;&gt;&gt; import simplejson
   &gt;&gt;&gt; simplejson.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':'))
   '[1,2,3,{&quot;4&quot;:5,&quot;6&quot;:7}]'
</pre>
  <p>Pretty printing:</p>
<pre class="literalblock">
   &gt;&gt;&gt; import simplejson
   &gt;&gt;&gt; print simplejson.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)
   {
       &quot;4&quot;: 5, 
       &quot;6&quot;: 7
   }
</pre>
  <p>Decoding JSON:</p>
<pre class="literalblock">
   &gt;&gt;&gt; import simplejson
   &gt;&gt;&gt; simplejson.loads('[&quot;foo&quot;, {&quot;bar&quot;:[&quot;baz&quot;, null, 1.0, 2]}]')
   [u'foo', {u'bar': [u'baz', None, 1.0, 2]}]
   &gt;&gt;&gt; simplejson.loads('&quot;\\&quot;foo\\bar&quot;')
   u'&quot;foo\x08ar'
   &gt;&gt;&gt; from StringIO import StringIO
   &gt;&gt;&gt; io = StringIO('[&quot;streaming API&quot;]')
   &gt;&gt;&gt; simplejson.load(io)
   [u'streaming API']
</pre>
  <p>Specializing JSON object decoding:</p>
<pre class="literalblock">
   &gt;&gt;&gt; import simplejson
   &gt;&gt;&gt; def as_complex(dct):
   ...     if '__complex__' in dct:
   ...         return complex(dct['real'], dct['imag'])
   ...     return dct
   ... 
   &gt;&gt;&gt; simplejson.loads('{&quot;__complex__&quot;: true, &quot;real&quot;: 1, &quot;imag&quot;: 2}',
   ...     object_hook=as_complex)
   (1+2j)
   &gt;&gt;&gt; import decimal
   &gt;&gt;&gt; simplejson.loads('1.1', parse_float=decimal.Decimal)
   Decimal(&quot;1.1&quot;)
</pre>
  <p>Extending JSONEncoder:</p>
<pre class="literalblock">
   &gt;&gt;&gt; import simplejson
   &gt;&gt;&gt; class ComplexEncoder(simplejson.JSONEncoder):
   ...     def default(self, obj):
   ...         if isinstance(obj, complex):
   ...             return [obj.real, obj.imag]
   ...         return simplejson.JSONEncoder.default(self, obj)
   ... 
   &gt;&gt;&gt; dumps(2 + 1j, cls=ComplexEncoder)
   '[2.0, 1.0]'
   &gt;&gt;&gt; ComplexEncoder().encode(2 + 1j)
   '[2.0, 1.0]'
   &gt;&gt;&gt; list(ComplexEncoder().iterencode(2 + 1j))
   ['[', '2.0', ', ', '1.0', ']']
</pre>
  <p>Using simplejson from the shell to validate and pretty-print:</p>
<pre class="literalblock">
   $ echo '{&quot;json&quot;:&quot;obj&quot;}' | python -msimplejson.tool
   {
       &quot;json&quot;: &quot;obj&quot;
   }
   $ echo '{ 1.2:3.4}' | python -msimplejson.tool
   Expecting property name: line 1 column 2 (char 2)
</pre>
  <p>Note that the JSON produced by this module's default settings is a 
  subset of YAML, so it may be used as a serializer for that as well.</p>

<hr />
<div class="fields">      <p><strong>Version:</strong>
        1.9.2
      </p>
</div><!-- ==================== SUBMODULES ==================== -->
<a name="section-Submodules"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Submodules</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Submodules"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
  <tr><td class="summary">
  <ul class="nomargin">
    <li class="private"> <strong class="uidlink"><a href="simplejson.decoder-module.html" onclick="show_private();">simplejson.decoder</a></strong>: <em class="summary">Implementation of JSONDecoder</em>    </li>
    <li class="private"> <strong class="uidlink"><a href="simplejson.encoder-module.html" onclick="show_private();">simplejson.encoder</a></strong>: <em class="summary">Implementation of JSONEncoder</em>    </li>
    <li class="private"> <strong class="uidlink"><a href="simplejson.scanner-module.html" onclick="show_private();">simplejson.scanner</a></strong>: <em class="summary">Iterator based sre token scanner</em>    </li>
    <li> <strong class="uidlink"><a href="simplejson.tool-module.html">simplejson.tool</a></strong>: <em class="summary">Using simplejson from the shell to validate and pretty-print:</em>    </li>
  </ul></td></tr>
</table>

<br />
<!-- ==================== CLASSES ==================== -->
<a name="section-Classes"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Classes</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Classes"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="simplejson.decoder.JSONDecoder-class.html" class="summary-name">JSONDecoder</a><br />
      Simple JSON &lt;http://json.org&gt; decoder
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="simplejson.encoder.JSONEncoder-class.html" class="summary-name">JSONEncoder</a><br />
      Extensible JSON &lt;http://json.org&gt; encoder for Python data 
        structures.
    </td>
  </tr>
</table>
<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="simplejson-module.html#dump" class="summary-sig-name">dump</a>(<span class="summary-sig-arg">obj</span>,
        <span class="summary-sig-arg">fp</span>,
        <span class="summary-sig-arg">skipkeys</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">ensure_ascii</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">check_circular</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">allow_nan</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">cls</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">indent</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">separators</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">encoding</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">utf-8</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">default</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">**kw</span>)</span><br />
      Serialize ``obj`` as a JSON formatted stream to ``fp`` (a 
      ``.write()``-supporting file-like object).</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="simplejson-pysrc.html#dump">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="simplejson-module.html#dumps" class="summary-sig-name">dumps</a>(<span class="summary-sig-arg">obj</span>,
        <span class="summary-sig-arg">skipkeys</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">ensure_ascii</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">check_circular</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">allow_nan</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">cls</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">indent</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">separators</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">encoding</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">utf-8</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">default</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">**kw</span>)</span><br />
      Serialize ``obj`` to a JSON formatted ``str``.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="simplejson-pysrc.html#dumps">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="simplejson-module.html#load" class="summary-sig-name">load</a>(<span class="summary-sig-arg">fp</span>,
        <span class="summary-sig-arg">encoding</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">cls</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">object_hook</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">parse_float</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">parse_int</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">parse_constant</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">**kw</span>)</span><br />
      Deserialize ``fp`` (a ``.read()``-supporting file-like object 
      containing a JSON document) to a Python object.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="simplejson-pysrc.html#load">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="simplejson-module.html#loads" class="summary-sig-name">loads</a>(<span class="summary-sig-arg">s</span>,
        <span class="summary-sig-arg">encoding</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">cls</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">object_hook</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">parse_float</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">parse_int</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">parse_constant</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">**kw</span>)</span><br />
      Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a 
      JSON document) to a Python object.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="simplejson-pysrc.html#loads">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="simplejson-module.html#decode" class="summary-sig-name" onclick="show_private();">decode</a>(<span class="summary-sig-arg">s</span>)</span><br />
      demjson, python-cjson API compatibility hook.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="simplejson-pysrc.html#decode">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="simplejson-module.html#encode" class="summary-sig-name" onclick="show_private();">encode</a>(<span class="summary-sig-arg">obj</span>)</span><br />
      demjson, python-cjson compatibility hook.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="simplejson-pysrc.html#encode">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="simplejson-module.html#read" class="summary-sig-name" onclick="show_private();">read</a>(<span class="summary-sig-arg">s</span>)</span><br />
      jsonlib, JsonUtils, python-json, json-py API compatibility hook.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="simplejson-pysrc.html#read">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="simplejson-module.html#write" class="summary-sig-name" onclick="show_private();">write</a>(<span class="summary-sig-arg">obj</span>)</span><br />
      jsonlib, JsonUtils, python-json, json-py API compatibility hook.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="simplejson-pysrc.html#write">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Variables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="simplejson-module.html#_default_encoder" class="summary-name" onclick="show_private();">_default_encoder</a> = <code title="JSONEncoder(skipkeys= False, ensure_ascii= True, check_circular= True,\
 allow_nan= True, indent= None, separators= None, encoding= 'utf-8', d\
efault= None,)">JSONEncoder(skipkeys= False, ensure_ascii= <code class="variable-ellipsis">...</code></code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="_default_decoder"></a><span class="summary-name">_default_decoder</span> = <code title="JSONDecoder(encoding= None, object_hook= None)">JSONDecoder(encoding= None, object_hook= None)</code>
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="dump"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">dump</span>(<span class="sig-arg">obj</span>,
        <span class="sig-arg">fp</span>,
        <span class="sig-arg">skipkeys</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">ensure_ascii</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">check_circular</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">allow_nan</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">cls</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">indent</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">separators</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">encoding</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">utf-8</code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">default</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">**kw</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="simplejson-pysrc.html#dump">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Serialize ``obj`` as a JSON formatted stream to ``fp`` (a 
  ``.write()``-supporting file-like object).</p>
  <p>If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic 
  types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, 
  ``None``) will be skipped instead of raising a ``TypeError``.</p>
  <p>If ``ensure_ascii`` is ``False``, then the some chunks written to 
  ``fp`` may be ``unicode`` instances, subject to normal Python ``str`` to 
  ``unicode`` coercion rules. Unless ``fp.write()`` explicitly understands 
  ``unicode`` (as in ``codecs.getwriter()``) this is likely to cause an 
  error.</p>
  <p>If ``check_circular`` is ``False``, then the circular reference check 
  for container types will be skipped and a circular reference will result 
  in an ``OverflowError`` (or worse).</p>
  <p>If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to 
  serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in 
  strict compliance of the JSON specification, instead of using the 
  JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).</p>
  <p>If ``indent`` is a non-negative integer, then JSON array elements and 
  object members will be pretty-printed with that indent level. An indent 
  level of 0 will only insert newlines. ``None`` is the most compact 
  representation.</p>
  <p>If ``separators`` is an ``(item_separator, dict_separator)`` tuple 
  then it will be used instead of the default ``(', ', ': ')`` separators. 
  ``(',', ':')`` is the most compact JSON representation.</p>
  <p>``encoding`` is the character encoding for str instances, default is 
  UTF-8.</p>
  <p>``default(obj)`` is a function that should return a serializable 
  version of obj or raise TypeError. The default simply raises 
  TypeError.</p>
  <p>To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the 
  ``.default()`` method to serialize additional types), specify it with the
  ``cls`` kwarg.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="dumps"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">dumps</span>(<span class="sig-arg">obj</span>,
        <span class="sig-arg">skipkeys</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">ensure_ascii</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">check_circular</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">allow_nan</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">cls</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">indent</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">separators</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">encoding</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">utf-8</code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">default</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">**kw</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="simplejson-pysrc.html#dumps">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Serialize ``obj`` to a JSON formatted ``str``.</p>
  <p>If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic 
  types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, 
  ``None``) will be skipped instead of raising a ``TypeError``.</p>
  <p>If ``ensure_ascii`` is ``False``, then the return value will be a 
  ``unicode`` instance subject to normal Python ``str`` to ``unicode`` 
  coercion rules instead of being escaped to an ASCII ``str``.</p>
  <p>If ``check_circular`` is ``False``, then the circular reference check 
  for container types will be skipped and a circular reference will result 
  in an ``OverflowError`` (or worse).</p>
  <p>If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to 
  serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in 
  strict compliance of the JSON specification, instead of using the 
  JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).</p>
  <p>If ``indent`` is a non-negative integer, then JSON array elements and 
  object members will be pretty-printed with that indent level. An indent 
  level of 0 will only insert newlines. ``None`` is the most compact 
  representation.</p>
  <p>If ``separators`` is an ``(item_separator, dict_separator)`` tuple 
  then it will be used instead of the default ``(', ', ': ')`` separators. 
  ``(',', ':')`` is the most compact JSON representation.</p>
  <p>``encoding`` is the character encoding for str instances, default is 
  UTF-8.</p>
  <p>``default(obj)`` is a function that should return a serializable 
  version of obj or raise TypeError. The default simply raises 
  TypeError.</p>
  <p>To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the 
  ``.default()`` method to serialize additional types), specify it with the
  ``cls`` kwarg.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="load"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">load</span>(<span class="sig-arg">fp</span>,
        <span class="sig-arg">encoding</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">cls</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">object_hook</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">parse_float</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">parse_int</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">parse_constant</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">**kw</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="simplejson-pysrc.html#load">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Deserialize ``fp`` (a ``.read()``-supporting file-like object 
  containing a JSON document) to a Python object.</p>
  <p>If the contents of ``fp`` is encoded with an ASCII based encoding 
  other than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name 
  must be specified. Encodings that are not ASCII based (such as UCS-2) are
  not allowed, and should be wrapped with 
  ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode`` 
  object and passed to ``loads()``</p>
  <p>``object_hook`` is an optional function that will be called with the 
  result of any object literal decode (a ``dict``). The return value of 
  ``object_hook`` will be used instead of the ``dict``. This feature can be
  used to implement custom decoders (e.g. JSON-RPC class hinting).</p>
  <p>To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` 
  kwarg.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="loads"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">loads</span>(<span class="sig-arg">s</span>,
        <span class="sig-arg">encoding</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">cls</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">object_hook</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">parse_float</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">parse_int</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">parse_constant</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">**kw</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="simplejson-pysrc.html#loads">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
  document) to a Python object.</p>
  <p>If ``s`` is a ``str`` instance and is encoded with an ASCII based 
  encoding other than utf-8 (e.g. latin-1) then an appropriate ``encoding``
  name must be specified. Encodings that are not ASCII based (such as 
  UCS-2) are not allowed and should be decoded to ``unicode`` first.</p>
  <p>``object_hook`` is an optional function that will be called with the 
  result of any object literal decode (a ``dict``). The return value of 
  ``object_hook`` will be used instead of the ``dict``. This feature can be
  used to implement custom decoders (e.g. JSON-RPC class hinting).</p>
  <p>``parse_float``, if specified, will be called with the string of every
  JSON float to be decoded. By default this is equivalent to 
  float(num_str). This can be used to use another datatype or parser for 
  JSON floats (e.g. decimal.Decimal).</p>
  <p>``parse_int``, if specified, will be called with the string of every 
  JSON int to be decoded. By default this is equivalent to int(num_str). 
  This can be used to use another datatype or parser for JSON integers 
  (e.g. float).</p>
  <p>``parse_constant``, if specified, will be called with one of the 
  following strings: -Infinity, Infinity, NaN, null, true, false. This can 
  be used to raise an exception if invalid JSON numbers are 
  encountered.</p>
  <p>To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` 
  kwarg.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="decode"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">decode</span>(<span class="sig-arg">s</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="simplejson-pysrc.html#decode">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>demjson, python-cjson API compatibility hook. Use loads(s) 
  instead.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="encode"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">encode</span>(<span class="sig-arg">obj</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="simplejson-pysrc.html#encode">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>demjson, python-cjson compatibility hook. Use dumps(s) instead.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="read"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">read</span>(<span class="sig-arg">s</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="simplejson-pysrc.html#read">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>jsonlib, JsonUtils, python-json, json-py API compatibility hook. Use 
  loads(s) instead.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="write"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">write</span>(<span class="sig-arg">obj</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="simplejson-pysrc.html#write">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>jsonlib, JsonUtils, python-json, json-py API compatibility hook. Use 
  dumps(s) instead.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== VARIABLES DETAILS ==================== -->
<a name="section-VariablesDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-VariablesDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="_default_encoder"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">_default_encoder</h3>
  
  <dl class="fields">
  </dl>
  <dl class="fields">
    <dt>Value:</dt>
      <dd><table><tr><td><pre class="variable">
JSONEncoder(skipkeys= False, ensure_ascii= True, check_circular= True,<span class="variable-linewrap"><img src="crarr.png" alt="\" /></span>
 allow_nan= True, indent= None, separators= None, encoding= 'utf-8', d<span class="variable-linewrap"><img src="crarr.png" alt="\" /></span>
efault= None,)
</pre></td></tr></table>
</dd>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Thu Jan 29 04:00:46 2009
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
